package com.xiaoxiong.mami.dao.mapper;

import com.xiaoxiong.mami.dao.daomain.OrderInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface OrderInfoMapper {
    @Delete({
        "delete from order_info",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into order_info (id, orderId, ",
        "orderType, orderTitle, ",
        "orderDescribe, orderAddress, ",
        "payType, orderStatus, ",
        "totalMoney, userId, ",
        "receiver, createTime, ",
        "updateTime, telephone, ",
        "orderIdentifier, statusName, ",
        "dealUserId)",
        "values (#{id,jdbcType=BIGINT}, #{orderId,jdbcType=VARCHAR}, ",
        "#{orderType,jdbcType=VARCHAR}, #{orderTitle,jdbcType=VARCHAR}, ",
        "#{orderDescribe,jdbcType=VARCHAR}, #{orderAddress,jdbcType=VARCHAR}, ",
        "#{payType,jdbcType=VARCHAR}, #{orderStatus,jdbcType=VARCHAR}, ",
        "#{totalMoney,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, ",
        "#{receiver,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, ",
        "#{updateTime,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, ",
        "#{orderIdentifier,jdbcType=VARCHAR}, #{statusName,jdbcType=VARCHAR}, ",
        "#{dealUserId,jdbcType=VARCHAR})"
    })
    int insert(OrderInfo record);

    @InsertProvider(type=OrderInfoSqlProvider.class, method="insertSelective")
    int insertSelective(OrderInfo record);

    @Select({
        "select",
        "id, orderId, orderType, orderTitle, orderDescribe, orderAddress, payType, orderStatus, ",
        "totalMoney, userId, receiver, createTime, updateTime, telephone, orderIdentifier, ",
        "statusName, dealUserId",
        "from order_info",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="orderId", property="orderId", jdbcType=JdbcType.VARCHAR),
        @Result(column="orderType", property="orderType", jdbcType=JdbcType.VARCHAR),
        @Result(column="orderTitle", property="orderTitle", jdbcType=JdbcType.VARCHAR),
        @Result(column="orderDescribe", property="orderDescribe", jdbcType=JdbcType.VARCHAR),
        @Result(column="orderAddress", property="orderAddress", jdbcType=JdbcType.VARCHAR),
        @Result(column="payType", property="payType", jdbcType=JdbcType.VARCHAR),
        @Result(column="orderStatus", property="orderStatus", jdbcType=JdbcType.VARCHAR),
        @Result(column="totalMoney", property="totalMoney", jdbcType=JdbcType.VARCHAR),
        @Result(column="userId", property="userId", jdbcType=JdbcType.VARCHAR),
        @Result(column="receiver", property="receiver", jdbcType=JdbcType.VARCHAR),
        @Result(column="createTime", property="createTime", jdbcType=JdbcType.VARCHAR),
        @Result(column="updateTime", property="updateTime", jdbcType=JdbcType.VARCHAR),
        @Result(column="telephone", property="telephone", jdbcType=JdbcType.VARCHAR),
        @Result(column="orderIdentifier", property="orderIdentifier", jdbcType=JdbcType.VARCHAR),
        @Result(column="statusName", property="statusName", jdbcType=JdbcType.VARCHAR),
        @Result(column="dealUserId", property="dealUserId", jdbcType=JdbcType.VARCHAR)
    })
    OrderInfo selectByPrimaryKey(Long id);

    @UpdateProvider(type=OrderInfoSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(OrderInfo record);

    @Update({
        "update order_info",
        "set orderId = #{orderId,jdbcType=VARCHAR},",
          "orderType = #{orderType,jdbcType=VARCHAR},",
          "orderTitle = #{orderTitle,jdbcType=VARCHAR},",
          "orderDescribe = #{orderDescribe,jdbcType=VARCHAR},",
          "orderAddress = #{orderAddress,jdbcType=VARCHAR},",
          "payType = #{payType,jdbcType=VARCHAR},",
          "orderStatus = #{orderStatus,jdbcType=VARCHAR},",
          "totalMoney = #{totalMoney,jdbcType=VARCHAR},",
          "userId = #{userId,jdbcType=VARCHAR},",
          "receiver = #{receiver,jdbcType=VARCHAR},",
          "createTime = #{createTime,jdbcType=VARCHAR},",
          "updateTime = #{updateTime,jdbcType=VARCHAR},",
          "telephone = #{telephone,jdbcType=VARCHAR},",
          "orderIdentifier = #{orderIdentifier,jdbcType=VARCHAR},",
          "statusName = #{statusName,jdbcType=VARCHAR},",
          "dealUserId = #{dealUserId,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(OrderInfo record);
}